<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="top.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet"  href="static/css/bootstrap.min.css" />
	<style type="text/css">
		body{
			padding-top:50px; 
		}
		img{
			float:right;
		}
	</style>
	
</head>
<body class="body">
	
	
	<div class="container">
	  <div class="row">
	  
		 <!-- 导入左侧部分 -->
		<jsp:include page="side.jsp">
			<jsp:param value="contact" name="tag"/>
		</jsp:include>
		
		<div class="span9">
			
			<ul class="breadcrumb" style="margin-bottom:10px;border-radius: 3px 3px 0 0">
				<li class="active">
					<a href="contact.jspx"><i class="icon-user"></i>联系人</a>
				</li>
			</ul>
			<div class="wall">
				<div class="row">
					<div class="span3">
						<a href="contact.jspx?m=new" class="btn span2"><i class="icon-plus"></i>添加联系人</a>
						<div class="clear"></div>
						<br/>
						    <ul class="unstyled" style="margin-top:20px">
							    <c:if test="${empty contactList}">
										本项目还没有添加联系人！
								</c:if>
						    	<c:forEach items="${contactList}" var="c">	
									<li style="line-height:30px"><i class="icon-list-alt"></i><a href="contact.jspx?id=${c.id }">${c.name}</a></li>
								</c:forEach>
						 	</ul>
						
					</div>
					
					<c:if test="${!(empty contact) }">
					
							<div class="span5" id="bt" style="min-height:400px;border-left:1px solid #ccc;padding-left:15px">
								<address  id="nr">
									<h3>${contact.name }</h3> <img alt="" src="contact.jspx?m=showCode&id=${contact.id}"/>
									<p>${contact.company }</p>
									<small>手机</small> ${contact.cellphone }<br/>
									<small>固话</small> ${contact.phone }<br/>
									<small>邮箱</small> ${contact.email }<br/> 
									<small>地址</small> ${contact.address} <input type="hidden" id="address" value="${contact.address }"/> 
									<div id="map" style="width:300px;height:300px"></div> 
									
									<small>主页</small> <a href="${contact.website }">${contact.website }</a><br/>
									<small>微博</small> <a href="${contact.weibo }">${contact.weibo }</a><br/>
								 
								
								</address>
							
								<div class="line">记录</div>
									<c:forEach items="${contactNoteList}" var="cn">	
											<blockquote>
													 ${cn.content }
												<small>${cn.user.name }发布于${cn.createtime }</small>
											</blockquote>
									</c:forEach>
							
							
								<a href="contactnote.jspx?id=${contact.id}">查看所有记录</a>
								<br/><br/><br/>
								<a class="btn btn-primary" href="contact.jspx?m=toUpdate&id=${contact.id}"><i class="icon-pencil icon-white"></i>编辑</a>
								<a class="btn btn-danger" href="contact.jspx?m=del&id=${contact.id}"><i class="icon-trash icon-white"></i>删除</a>
						</div>
					
					</c:if>
				</div>
					
			</div>
			
			
		</div>
	  </div>
	</div>
	
	<script src="static/js/jquery.js" type="text/javascript"></script>
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
	<script type="text/javascript" src="https://raw.github.com/HPNeo/gmaps/master/gmaps.js"></script>
	
	<script type="text/javascript">
		var map;
		$(document).ready(function(){
			
			map = new GMaps({
					div: '#map',
					lat: 35.2193612,
					lng: 113.2482923 
			});
			
			
				GMaps.geocode({
				  address: $("#address").val(),
				  callback: function(results, status) {
					if (status == 'OK') {
					  var latlng = results[0].geometry.location;
					  map.setCenter(latlng.lat(), latlng.lng());
					  map.addMarker({
						lat: latlng.lat(),
						lng: latlng.lng()
					  });
					}
				  }
				});
			});
			
		
	</script>
	
</body>
</html>